package cn.echase.ecare.yinfayun.controller.statistics;

import cn.echase.common.result.aop.EchaseResponseResult;
import cn.echase.ecare.yinfayun.domain.dto.ElderStatisticsDto;
import cn.echase.ecare.yinfayun.domain.dto.StatisticsDto;
import cn.echase.ecare.yinfayun.domain.vo.ElderAgeInfoVo;
import cn.echase.ecare.yinfayun.domain.vo.OrgElderCenterVo;
import cn.echase.ecare.yinfayun.service.IElderAgeStatisticService;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.satoken.utils.LoginHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 长者年龄统计
 * */
@Slf4j
@RestController
@EchaseResponseResult
@RequestMapping("/age/statistic")
public class ElderAgeStatisticController {

    @Autowired
    private IElderAgeStatisticService elderAgeStatisticService;

    @RequestMapping(value = "pageList", method = RequestMethod.POST)
    @Log(title = "查询", businessType = BusinessType.OTHER)
    public TableDataInfo<ElderAgeInfoVo> getEldersAgeStatisticPageList(@RequestBody StatisticsDto statisticsDto) {
        statisticsDto.setOrgId(LoginHelper.getOrgId());
        return elderAgeStatisticService.eldersAgeStatisticPageList(statisticsDto);
    }

    @RequestMapping(value = "list", method = RequestMethod.GET)
    @Log(title = "查询", businessType = BusinessType.OTHER)
    public List<ElderAgeInfoVo> getEldersAgeStatisticList() {
        StatisticsDto statisticsDto = new StatisticsDto();
        statisticsDto.setOrgId(LoginHelper.getOrgId());
        return elderAgeStatisticService.eldersAgeStatisticList(statisticsDto);
    }

    @RequestMapping(value = "statisticInfo", method = RequestMethod.GET)
    @Log(title = "查询", businessType = BusinessType.OTHER)
    public Map<String, Object> getElderAgeStatisticInfo() {
        StatisticsDto statisticsDto = new StatisticsDto();
        statisticsDto.setOrgId(LoginHelper.getOrgId());
        return elderAgeStatisticService.getElderAgeStatisticInfo(statisticsDto);
    }


    @RequestMapping(value = "elderList", method = RequestMethod.POST)
    @Log(title = "查询", businessType = BusinessType.OTHER)
    public TableDataInfo<OrgElderCenterVo> getElderAgeDetailList(@RequestBody ElderStatisticsDto elderStatisticsDto) {
        elderStatisticsDto.setOrgId(LoginHelper.getOrgId());
        return elderAgeStatisticService.getElderAgeDetailList(elderStatisticsDto);
    }

}
